package com.yuankun.chat.entity.vo;

import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.ai.chat.messages.Message;

/**
 * @Author：yuankun
 * @Package：com.yuankun.chat.entity.vo
 * @Project：chat
 * @name：MessageVo
 * @Date：2025/8/18 20:07
 * @Filename：MessageVo
 */
@NoArgsConstructor
@Data
public class MessageVo {
    private String role;
    private String content;
    public MessageVo(Message message) {
        switch (message.getMessageType()) {
            case USER -> this.role = "user";
            case ASSISTANT -> this.role = "assistant";
            default -> this.role = "default";
        }
        this.content = message.getText();
    }
}
